# -*- coding: utf-8 -*-

"""
* Copyright (C) 2016 GridSafe, Inc.
"""
import re
from django.views.generic import TemplateView
from apps.wallet.logging import view_log


class HomepageView(TemplateView):
    template_name = 'app/homepage.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        view_log.info('some one enter to homepage')
        return context

    def get_template_names(self):
        user_agent = self.request.META.get('HTTP_USER_AGEMT')
        result = re.search('Android|webOS|iPhone|iPad|iPod|Opera Mini',
                           user_agent)
        if result:
            return 'app/mobile-homepage.html'
        else:
            return self.template_name


class AccessWayPageView(TemplateView):
    template_name = 'app/access_way.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        view_log.info('some enter access_way page')
        return context


class CommunityPageView(TemplateView):
    template_name = 'app/access_way.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        return context
